import java.util.Scanner;//导入的包

public class Test {
    public static void main(String[] args) {
        int n = 7;
        int i=0;
        //获取奇数位
        System.out.print("奇数位：");
        for(i=30;i>=0;i-=2) {

            System.out.print(((n>>>i)&1)+" ");
        }
        System.out.println();
        System.out.print("偶数位：");
        for(i=31;i>=1;i-=2) {

            System.out.print(((n>>>i)&1)+" ");
        }

    }
    public static void main9(String[] args) {
        //求二进制中1的个数
      /* int a = -1;
       int sum = 0;
       int i = 0;
       for(i=0;i<32;i++) {
           if(((a>>>i)&1)==1) {
               sum++;
           }
       }
       System.out.println(sum);*/
        int n = 7;
        int i = 0;
        while(n!=0) {
            n=n&(n-1);
            i++;
        }
        System.out.println(i);
    }
    public static void main8(String[] args) {
       //求最大公因数
//        int a = 12;
//        int b = 16;
//        int c = a%b;
//        while(c!=0) {
//            a = b;
//            b = c;
//            c = a%b;
//        }
//        System.out.println("最大公约数："+b);
        int a = 12;
        int b = 16;
        int min=a>b?b:a;//找最小值
        while(min>=1) {
            if(a%min==0&&b%min==0) {

                break;
            }
            min--;
        }
        System.out.println("最大公约数是："+min);
    }
    public static void main7(String[] args) {
        //输出九九口诀表
        int i=1;
        for(i=1;i<=9;i++) {
            int j=1;
            for(j=1;j<=i;j++) {
                System.out.print(i+"*"+"="+(i*j)+" ");

            }
            System.out.println();
        }

    }
    public static void main6(String[] args) {
        //输出1000-2000之间的闰年
        int year = 1000;
        while(year<=2000) {
            if(year%400==0||(year%100!=0&&year%4==0)) {
                System.out.println(year);
            }
            year++;
        }
    }

    public static void main5(String[] args) {//判断素数
       int ret = 2;
       while(ret<=100) {
           int j=2;
           boolean tmp = true;
           while(j<=Math.sqrt(ret)) {
               if(ret%j==0) {
                   tmp = false;
                   break;
               }
               j++;
           }
           if(tmp) {
               System.out.println(ret+"是素数");
           }
           ret++;
       }

    }
    public static void main4(String[] args) {//判断素数
        Scanner scanner = new Scanner(System.in);
        int ret = scanner.nextInt();
        int i=2;
        boolean tmp = true;
        while(i<=Math.sqrt(ret)) {
            if(ret%i==0) {
                System.out.println(ret+"不是素数");
                tmp = false;
                break;
            }
            i++;
        }
        if(tmp) {
            System.out.println(ret+"是素数");
        }
        scanner.close();//关闭工具
    }
    public static void main3(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int age = scanner.nextInt();
        if(age<=18) {
            System.out.println("少年");
        } else if(age >= 19 && age<=28) {
            System.out.println("青年");
        } else if(age>=29 && age<=55) {
            System.out.println("中年");
        } else {
            System.out.println("老年");
        }
    }
    public static void main2(String[] args) {
        Scanner scanner =new Scanner(System.in);//工具
        int a = scanner.nextInt();//输入数据
       System.out.println(a);
    }
    public static void main1(String[] args) {

        int i = 1;
        while(i<=100) {
            if(i%3!=0||i%5!=0) {
                i++;
                continue;
            }
            System.out.println(i);
            i++;

        }
    }
}
